﻿<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../Css/Navigation.css" type="text/css">
    <link rel="stylesheet" href="../Css/SelectControl.css" type="text/css">
    <link rel="stylesheet" href="../Css/AdSetting.css" type="text/css">
</head>
<body>
    <div class="css_main">
        <div class="css_top">
            <div class="css_top_left">
                <span>美位生活 & meiwei life</span><br>
                <span>App 管理操作后台</span>
            </div>
            <div class="css_top_right">
                <span style="Float:right">欢迎！Lain</span><br>
                <span style="Float:right">2015.02.08 09:35 AM</span>
            </div>
        </div>
        <div class="css_body">
            <div class="css_navigation">
                <div class="css_navigationItem">
                    <ul>商 户 添 加</ul>
                    <li><span class="css_inActive">&#12288</span><a href="IDelicious.html">爱 美 味</a></li>
                    <li><span class="css_inActive">&#12288</span><a href="EnjoyLife.html">乐 生 活</a></li>
                </div>
                <div class="css_navigationItem">
                    <ul><a href="BusinessInformation.html">商 户 信 息</a></ul>
                </div>
                <div class="css_navigationItem">
                    <ul>分 类 管 理</ul>
                    <li><span class="css_inActive">&#12288</span><a href="AppCategory.html">APP 类 目</a></li>
                    <li><span class="css_inActive">&#12288</span><a href="SceneClassification.html">场 景 分 类</a></li>
                    <li><span class="css_inActive">&#12288</span><a href="AreaClassificationOne.html">区 域 分 类</a></li>
                </div>
                <div class="css_navigationItem">
                    <ul><a href="UserInfo.html">用 户 信 息</a></ul>
                </div>
                <div class="css_navigationItem">
                    <ul>服 务 设 置</ul>
                    <li><span class="css_inActive">&#12288</span><a href="ServicesModification.html">服 务 修 改</a></li>
                    <li><span class="css_inActive">&#12288</span><a href="CouponsGeneration.html">折 扣 券 生 成</a></li>
                    <li><span class="css_inActive">&#12288</span><a href="CouponsStatus.html">折 扣 券 状 态</a></li>
                </div>
                <div class="css_navigationItem">
                    <ul>广 告 设 置</ul>
                    <li><span class="css_active"> > </span><a class="css_active" href="AdSetting.html">广 告 设 置</a></li>
                    <li><span class="css_inActive">&#12288</span><a href="AddEvents.html">添 加 活 动</a></li>
                    <li><span class="css_inActive">&#12288</span><a href="EventsList.html">活 动 列 表</a></li>
                    <li><span class="css_inActive">&#12288</span><a href="TransactionList.html">成 交 列 表</a></li>
                </div>
                <div class="css_navigationItem">
                    <ul>文 章 管 理</ul>
                    <li><span class="css_inActive">&#12288</span><a href="ArticleList.html">文 章 列 表</a></li>
                    <li><span class="css_inActive">&#12288</span><a href="AddArticle.html">添 加 文 章</a></li>
                </div>
                <div class="css_navigationItem">
                    <ul><a href="DataExport.html">数 据 管 理</a></ul>
                </div>
            </div>
            <div class="css_content" ng-app="" ng-controller="getBusinessIdController">
                <div class="css_content_userTable">
                    <div class="css_content_userTable_title">
                        <div class="css_content_userTable_title_name">
                            <span>广告设置</span>
                        </div>
                    </div>

                    <div class="css_content_pictures">
                        <div class="css_content_pictures_discription">
                            <span>
                                特权轮播
                                <input id="btnSepcAd" class="css_button_commonConfirm" type="button" value="确认" />
                            </span>
                        </div>

                        <div class="css_content_pictures_group">
                            <li>
                                <img id="pickfiles10" src="../Img/Img_UpLoadButton.png" />
                                <div>
                                    <span>图片上传</span><img style="visibility:hidden" />
                                </div>
                                <!--<img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>-->
                                <table>
                                    <tbody>
                                        <tr>
                                            <td class="tbheaderTitle">商户ID:</td>
                                            <td>
                                                <input class="tbheaderContent" type="text" value="商户ID" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tbheaderTitle">链接:</td>
                                            <td>
                                                <input class="tbheaderContent" type="text" value="链接" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tbheaderTitle">截止时间:</td>
                                            <td>
                                                <input class="tbheaderContent" type="text" value="时间" />
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>链接:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>链接:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>链接:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>链接:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                        </div>
                        <div class="css_content_pictures_group">
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>链接:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>链接:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>链接:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>链接:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>链接:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                        </div>

                        <div class="css_content_pictures_discription">

                            <span>
                                爱美味轮播
                                <input id="btnImwAd" class="css_button_commonConfirm" type="button" value="确认" />
                            </span>
                        </div>
                        <div class="css_content_pictures_group">
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                        </div>
                        <div class="css_content_pictures_group">
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                        </div>

                        <div class="css_content_pictures_discription">
                            <span>
                                乐生活轮播
                                <input id="btnImwAd" class="css_button_commonConfirm" type="button" value="确认" />
                            </span>
                        </div>
                        <div class="css_content_pictures_group">
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                        </div>
                        <div class="css_content_pictures_group">
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                            <li>
                                <img src="../Img/Img_UpLoadButton.png" />
                                <div>图片上传</div>
                                <table>
                                    <tbody>
                                        <tr><td>商户ID:</td><td></td></tr>
                                        <tr><td>截止时间:</td><td></td></tr>
                                    </tbody>
                                </table>
                            </li>
                        </div>

                        <div class="css_content_pictures_discription">启动广告</div>
                        <div class="css_content_pictures_group">
                            <ul id="container1">
                                <li style="height: 180px; line-height: 180px">
                                    <img id="pickfiles1" src="../Img/Img_UpLoadButton.png" />
                                    <div>
                                        <span>图片上传</span><img style="visibility:hidden" />
                                    </div>
                                </li>
                            </ul>
                            <table style="padding-left: 10px">
                                <tbody>
                                    <tr>
                                        <td>商户ID:</td>
                                        <td>
                                            <select id="js_scencOne"
                                                    data-ng-model="$scope.businessIds"
                                                    data-ng-options="a.BusinessName+' (' + a.Id + ')' for a in businessIds"
                                                    class="cate_drop dropdown"></select>
                                        </td>
                                        <td style="border:none;"></td>
                                    </tr>
                                    <tr>
                                        <td>链接:</td>
                                        <td>
                                            <input id="js_start_link" type="text" />
                                        </td>
                                        <td style="border:none;"></td>
                                    </tr>
                                    <tr><td colspan="2"><span style="float:left">发布时间:</span><input id="js_start_limit_time" type="text" value="2015.03.01" /></td></tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="css_button_contain">
                            <input id="js_confirm" class="css_button_confirm" type="button" value="确认" />
                        </div>
                    </div>
                </div>




                <br>
                <br>
                <br>
                <br>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="../JSLibrary/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../JSLibrary/SelectControl.js"></script>
    <script type="text/javascript" src="../JSLibrary/plupload.full.min.js"></script>
    <script type="text/javascript" src="../JSLibrary/jquery.Jcrop.min.js"></script>
    <script type="text/javascript">
        var fileName = "";
        var adSetting_Id = guid();
        var new_adSetting_Id = adSetting_Id;

        $(function () {

            SetUpLoad(1);
        })

        function SetUpLoad(orderNo) {
            var jcrop_api;
            var uploadCount = 0;

            var uploader = new plupload.Uploader({
                runtimes: 'html5,flash,silverlight,html4',
                browse_button: 'pickfiles' + orderNo, // you can pass in id...
                container: document.getElementById('container' + orderNo), // ... or DOM Element itself
                url: '../WebService1.asmx/SaveAdImgs',
                flash_swf_url: '../js/Upload.aspx.swf',
                silverlight_xap_url: '../js/Moxie.xap',
                multipart_params: { 'adSetting_Id': '' },

                filters: {
                    max_file_size: '5mb',
                    mime_types: [
                        { title: "Image files", extensions: "jpg,gif,png" }
                        //{ title: "Zip files", extensions: "zip" }
                    ]
                },

                init: {
                    FilesAdded: function (up, file) {
                        var id = uploader.settings.browse_button;
                        var picGroup = $(id).parent().parent().parent('.css_content_pictures_group');
                        picGroup.addClass("js_new");
                        picGroup.attr("id", guid());
                        //uploader.settings.multipart_params.adSetting_Id = adSetting_Id;
                        //up.start();
                    },

                    UploadProgress: function (up, file) {

                        $("#Progress").html("长传进度" + file.percent + "%");
                    },

                    Error: function (up, err) {
                        document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
                    },

                    FileUploaded: function (up, file, info) {

                        var picPath = "../Uploads/" + info.response;
                        fileName = info.response;
                        $('#container' + orderNo + ' div span').remove();
                        $('#container' + orderNo + ' div img').attr('src', picPath);
                        $('#container' + orderNo + ' div img').attr('style', "width:140px;height:108px;visibility:visible");

                    },
                }
            });

            uploader.init();
        };

        $("#js_confirm").click(function () {
            var id = $('')
            var flag = "true";
            var businessId = "";
            var adType = "APPLICATION_START";
            $.ajax({
                type: "POST", //访问WebService使用Post方式请求
                contentType: "application/json;charset=utf-8", //WebService 会返回Json类型
                url: "../WebService1.asmx/CreateAdSettings", //调用WebService
                data: "{id:'" + id + "',flag:'" + flag + "',adType:'" + adType + "',businessId:'" + businessId + "'}", //Email参数
                dataType: 'json',

                error: function (x, e) {
                    alert("error");
                },
                success: function (response) { //回调函数，result，返回值
                    alert(response.d);
                }
            })
        })

        function guid() {
            return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
        }
        function s4() {
            return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
        };

        //var uploader = new plupload.Uploader({
        //    //browse_button: 'browse', //触发文件选择对话框的按钮，为那个元素id
        //    //url: 'upload.php', //服务器端的上传页面地址
        //    //flash_swf_url: 'js/Moxie.swf', //swf文件，当需要使用swf方式进行上传时需要配置该参数
        //    //silverlight_xap_url: 'js/Moxie.xap' //silverlight文件，当需要使用silverlight方式进行上传时需要配置该参数
        //    runtimes: 'html5,flash,silverlight,html4',
        //    browse_button: 'pickfiles', // you can pass in id...
        //    container: document.getElementById('container1'), // ... or DOM Element itself
        //    url: '../WebService1.asmx/SaveAdImgs',
        //    flash_swf_url: '../js/Upload.aspx.swf',
        //    silverlight_xap_url: '../js/Moxie.xap',
        //    multipart_params: {
        //        'adSetting_Id': '',
        //        'businessId': '',
        //        'imgName': '',
        //        'linkName': ''
        //    },
        //});

        ////在实例对象上调用init()方法进行初始化
        //uploader.init();

        ////绑定各种事件，并在事件监听函数中做你想做的事
        //uploader.bind('FilesAdded', function (uploader, files) {

        //});
        //uploader.bind('UploadProgress', function (uploader, file) {
        //    $('#Progress').html("长传进度" + file.percent + "%");
        //});
        //$("#js_confirm").on('click', function () {

        //    var businessId = $('#js_start_businessId');
        //    var linkName = $('#js_start_link');
        //    var imgName = $('#imgName');

        //    if (businessId) {

        //    }
        //    uploader.start();

        //});
        function getBusinessIdController($scope, $http) {

            $scope.businessIds = [];
            var url = '../WebService1.asmx/ResponseBusiness';

            $http.get(url)
                 .success(function (response) {
                     if (response != undefined) {
                         //var result = JSON.parse(response)
                         $scope.businessIds = response;

                     }
                 })
                 .error(function (data, status, headers, config) {
                     alert("error");
                 })
        }

    </script>

    <script src="http://apps.bdimg.com/libs/angular.js/1.2.15/angular.min.js"></script>

</body>
</html>